﻿using System.ComponentModel.DataAnnotations;

namespace Ams.Mvc.Bootstrap.Annotations
{
    public class PostalCodeAttribute : RegularExpressionAttribute
    {
        public PostalCodeAttribute() : base(@"(^\d{5}(-\d{4}){0,1}$)")
        {
            ErrorMessage = "Not a valid 5 or 9 digit zip code";
        }
        public PostalCodeAttribute(string errorMessage) : base(@"(^\d{5}(-\d{4}){0,1}$)")
        {
            ErrorMessage = errorMessage;
        }
    }
}
